<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>EPK.</title>
</head>
<script type="text/javascript"> 
		function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="images/thinbarbkg.jpg">
<table cellspacing="0" cellpadding="0" border="0" height="66" width="100%">
  <tr valign="top"> 
    <td width="796" height="2"><img src="images/topbar.jpg" width="409" height="138"><img src="images/topbar1.jpg" width="353" height="138"><br>
      <img src="images/bottombar.jpg" width="762" height="52"></td>
  </tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" height="208" width="751">
  <tr> 
    <td width="238" height="2" valign="top"> 
      <div align="left"><img src="images/breaker.jpg" width="238" height="38"><br>
        <img src="images/breaker1_hutsa.jpg" width="238" height="31"><br></div>
    </td>
    <td width="495" height="2" valign="top" align="left"> 
    
		<? 	$pasa_bai=false;
			$bat=$_COOKIE["bat"];
			$bi=$_COOKIE["bi"];
			if (!$konexioa=mysql_connect('localhost')) {
   				die('Ez da konektatu : ' . mysql_error());
			}// if konexioa
			if (!mysql_select_db("users")){
   				die("Ez da datu-basea existitzen - oO!");
			}//if select_db
			$sql_gald="SELECT * FROM erabiltzaileak WHERE izena='$bat' && pasahitza='$bi'";
			$pito= mysql_query($sql_gald) or die(mysql_error());
			if ($kaka=mysql_fetch_array($pito))
			{//emaitza dau
				$pasa_bai=true;
			}
		
      	if(!$pasa_bai){?>
             <p><br /><p>
      <b>Ez daukazu baimenik atal honetan egoteko.</b>
      <div align="center"><a href="javascript:history.back()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('itzuli2','','images/itzuli2.jpg',1)"><img src="images/itzuli1.jpg" name="itzuli2" border="0" id="itzuli2" /></a></div>
		<? 
		}else{ 

		if (!mysql_select_db("planak")){
   				die("Ez da datu-basea existitzen - oO!");
			}//if select_db

		$id = $_POST['ident'];
		$data = $_POST['data'];
		$kiro = $_POST['kirolaria'];
		$rep = $_POST['rep'];
		$pis = $_POST['pisua'];
		$arikK = $_POST['arik'];
		$pBB = $_POST['pisuaBB'];
		$rBB = $_POST['repBB'];
		$repSer = $_POST['repSer'];
		$ser = $_POST['ser'];
		$z[0] = $_POST['z0'];
		for ($i=0;$i<10;$i++){
			$indizea = z.$i;
			$z[$i] = $_POST[$indizea]; 
		}
		$i=0;
		while($i<100){
			$i = $i +5;
			$indizea = m.$i;
			$m[$i] = $_POST[$indizea];
		}
		
		$sql_gald="INSERT INTO `laburpenak`  ( `planid` , `data` , `Kirolaria` , `ErrepikapenKopurua` , `Pisua` , `AriketaKopurua` , `PisuaBB` , `ErrepikapenakBB` , `ErrepikapenakSerieko` , `Serieak` , `zona0` , `zona1` , `zona2` , `zona3` , `zona4` , `zona5` , `zona6` , `zona7` , `zona8` , `zona9` , `max5` , `max10` , `max15` , `max20` , `max25` , `max30` , `max35` , `max40` , `max45` , `max50` , `max55` , `max60` , `max65` , `max70` , `max75` , `max80` , `max85` , `max90` , `max95` , `max100` , `Mota` ) VALUES ( '$id', '$data', '$kiro', '$rep', '$pi', '$arikK', '$pBB','$BB','$repSer','$ser','$z[0]','$z[1]','$z[2]','$z[3]','$z[4]','$z[5]','$z[6]','$z[7]','$z[8]','$z[9]','$m[5]','$m[10]','$m[15]','$m[20]','$m[25]','$m[30]','$m[35]','$m[40]','$m[45]','$m[50]','$m[55]','$m[60]','$m[65]','$m[70]','$m[75]','$m[80]','$m[85]','$m[90]','$m[95]','$m[100]','astekoa' );";
		$emaitza1= mysql_query($sql_gald) or die(mysql_error());
	 	if (!$emaitza)
		 	{//emaitza hutsa da, ondo!
		 	?> <div align="center"> <?
				echo "<h3>Laburpena ondo gorde da</h3>";
				?> <div align="center"><a href="laburpena.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('itzuli2','','images/itzuli2.jpg',1)"><img src="images/itzuli1.jpg" name="itzuli2" border="0" id="itzuli2" /></a></div> <?
		}
		else {
	?> <div align="center"> <?
					echo "<h3>Ezin izan da laburpena gorde</h3>"; ?> 
					<a href="laburpena.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('itzulikk','','images/jarraitu1s.jpg',1)"><img src="images/jarraitu1.jpg" name="itzulikk" border="0" id="itzulikk" /></a></div><?
		
	}//else konexioa
	mysql_close($konexioa);
	}
?> </p>
      </div>
    <td width="18" height="2" valign="top" align="left">&nbsp; </td>
  </tr>
</table>

</body>
</html>